package proj1;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber
{
    public static void main(String[] args)
      {
        Scanner scan = new Scanner(System.in);
        Random random = new Random();
        A:while(true)
          {
            int sj = random.nextInt(99)+1;
            for(int a = 0 ; a<7 ; a++)
              {
                System.out.print("请输入一个数字:");
                int js = scan.nextInt();
                if(sj == js)
                  {
                    System.out.println("你猜对了");
                    break;
                  }
                else if(js > sj)
                  {
                    System.out.println("你猜大了");
                  }
                else
                  {
                    System.out.println("你猜小了");
                  }
              }
            System.out.print("游戏结束\n再玩一局请输入1,结束游戏请输入0\n请输入:");
            int xz = scan.nextInt();
            if(xz == 0)
              {
                break A;
              }
            else if(xz == 1)
              {
                System.out.println("<-----开始游戏----->");
              }
          }
        System.out.println("你已退出游戏");
      }
}
